package com.neko.Thread_Learning;

import com.neko.utils.WebDownload;

class Thread_Test3_2 implements Runnable {

    private String url;
    private String fileName;

    public Thread_Test3_2(String url, String name) {
        this.url = url;
        this.fileName = name;
    }

    @Override
    public void run() {
        WebDownload webDownload = new WebDownload();

        webDownload.download(url, fileName);

        System.out.println("你下载了 文件名为：" + fileName);
    }

    // Main
    public static void main(String[] args) {

        t2_MultiThread_Download r1 = new t2_MultiThread_Download("https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=2124072373,529333338&fm=26&gp=0.jpg", "1.jpg");
        t2_MultiThread_Download r2 = new t2_MultiThread_Download("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1599336059576&di=59a91f0952a977ecb642092ad9356349&imgtype=0&src=http%3A%2F%2Fb-ssl.duitang.com%2Fuploads%2Fitem%2F201612%2F14%2F20161214221249_cCF4z.jpeg", "2.jpg");
        t2_MultiThread_Download r3 = new t2_MultiThread_Download("https://ss0.bdstatic.com/70cFuHSh_Q1YnxGkpoWK1HF6hhy/it/u=2159465980,1485649590&fm=26&gp=0.jpg", "3.jpg");


        new Thread(r1).start();
        new Thread(r2).start();
        new Thread(r3).start();
    }
}


